#!/usr/bin/ruby -w

#  myvnet - a virtual honeypot
#
#  Copyright (C) 2008  Filipe David Borba Manana,  fdmanana@gmail.com
#
#  This program is free software: you can redistributole it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation, either version 3 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program.  If not, see <http://www.gnu.org/licenses/>.


unless Process::Sys.getuid.zero?
  STDERR.puts "[FATAL] myvnet must be run by user `root'."
  exit 1
end


$LOAD_PATH.unshift '.'
$LOAD_PATH.pop if $LOAD_PATH[-1] == '.'

require 'lib/config'
require 'lib/daemon_launcher'


# parse config file and command line options
conf = Config.init

$log[:stdout].info "Debug mode enabled" if conf.debug

$log[:stdout].info "Using interface `#{conf.interface}'"

conf.net_addresses.each do |a|
  $log[:stdout].info "Simulating host with network address `#{a}'"
end

$log[:stdout].info "Ctrl+C (sig INT) to stop myvnet."

Daemon::Launcher.instance.start

